﻿CREATE FUNCTION dbo.RequestStatus_Attr
( @ProcID int,
	@StatusID int = NULL
)RETURNS bit
AS
BEGIN

DECLARE @AttrName sysname SET @AttrName = REVERSE(dbo.GetTokenLeft(REVERSE(OBJECT_NAME(@PROCID)),'_'))

RETURN (

SELECT count(*)FROM t_Menu CROSS APPLY Split(Attributes, ',') WHERE MenuID = @StatusID AND Element = @AttrName

)

END


